<!--
 * @Description: In User Settings Edit
 * @Author: your name
 * @Date: 2019-08-05 15:16:04
 * @LastEditTime: 2019-12-08 12:23:33
 * @LastEditors: Please set LastEditors
 -->
<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>Hello APP</title>
    <link rel="stylesheet" type="text/css" href="../css/vant.css">
    <link rel="stylesheet" type="text/css" href="../css/base.css" />
    <script type="text/javascript" src="../script/jquery.js"></script>
    <script type="text/javascript" src="../script/layer/mobile/layer.js"></script>
    <script type="text/javascript" src="../script/vue.min.js"></script>
    <script type="text/javascript" src="../script/vant.min.js"></script>
    <script type="text/javascript" src="../script/fastclick.js"></script>
    <script type="text/javascript" src="../script/base.js"></script>
    <style type="text/css">
        .mt {
            margin-top: 10px;
        }

        .van-panel__header-value {
            color: #969799;
        }

        .oun {
            color: #1989fa;
        }

        .un {
            color: #cd1b21;
        }

        .van-cell__title {
            max-width: 90%;
        }

        .van-cell__value {
            text-align: right;
        }

        .label {
            line-height: 22px;
            text-align: left;
            font-weight: 500;
            font-size: 13px;
            color: #969799;
            padding: 8px 0;
            padding-left: 15px;
        }
        .van-cell__right-icon{
            margin-top:-2px;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak>
        <div class="init-full">
            <van-nav-bar class="head" title="下单列表" left-arrow @click-left="onClickLeft">
                <div slot="right" class="head-right">

                </div>
            </van-nav-bar>
            <div class="body-no-bottom">
                <div class="content">
                    <van-tabs v-model="tabActive">
                        <van-tab title="待处理">
                            <van-panel class="mt" v-for="(row,index) in dataList1" @click="intoDetail(row)">
                                <div slot="header">
                                    <van-cell :title="row.ClientName" is-link>
                                    </van-cell>
                                </div>
                                <div class="label">
                                    <div>下单时间：{{row.OrderDate.replace(/T/g,' ')}}</div>
                                </div>
                            </van-panel>
                        </van-tab>
                        <van-tab title="已处理">
                            <van-panel class="mt" v-for="(row,index) in dataList2" @click="intoDetail(row)">
                                <div slot="header">
                                    <van-cell :title="row.ClientName" is-link :clickable="false">
                                        <div :class="row.Status==1?'oun':'un'">{{row.Status==1?'已同意':'已取消'}}</div>
                                    </van-cell>
                                </div>
                                <div class="label">
                                    <div>下单时间：{{row.OrderDate.replace(/T/g,' ')}}</div>
                                </div>
                            </van-panel>
                        </van-tab>

                    </van-tabs>


                </div>
                <van-loading v-if="showLoading" />
            </div>
        </div>
    </div>
</body>

<script type="text/javascript">
    var vm;
    apiready = function () {
        //$('.init-full').show();

        api.addEventListener({
            name: 'keyback'
        }, function (ret, err) {
            vm.onClickLeft();
        });

        api.addEventListener({
            name: 'refreshList'
        }, function (ret, err) {
            vm.getList();
        })
        var userInfo = FLD.getUserInfo();
        vm = new Vue({
            el: '#app',
            data: {
                showLoading: false,
                tabActive: 0,
                dataList1: [],
                dataList2: []

            },
            created: function () {
                this.getList();
            },
            methods: {
                getList() {
                    var that = this;
                    that.showLoading = true;
                    var obj1 = {
                        BranchID: userInfo.S_BranchID,
                        Status: 0
                    }
                    FLD.ajax('getBsOrderList', obj1, function (res) {
                        that.showLoading = false;
                        that.dataList1 = res.ds;
                    })
                    var obj2 = {
                        BranchID: userInfo.S_BranchID,
                        Status: 1
                    }
                    FLD.ajax('getBsOrderList', obj2, function (res) {
                        that.showLoading = false;
                        that.dataList2 = res.ds;
                    })

                },


                intoDetail(row) {
                    api.openWin({
                        name: 'orderListDetail',
                        url: 'orderListDetail.html',
                        reload: true,
                        slidBackEnabled: false,
                        pageParam: {
                            detailData: row
                        }
                    })

                },
                onClickLeft() {
                    api.closeWin();
                }
            }
        })
    };
</script>

</html>